//第一次作业
import java.util.Scanner;
public class Calculator {
	public void add(double num1,double num2) {
		System.out.println(num1 + num2);
	}
	public void subtraction(double num1,double num2) {
		System.out.println(num1 - num2);
	}
	public void multiply(double num1,double num2) {
		System.out.println(num1 * num2);
	}
	public void divide(double num1,double num2) {
		if(num2==0) {
			System.out.println("除数不能为0!");
		}else {
			System.out.println(num1 / num2);
		}
	}
	public void calc() {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入需要计算的第一个数：");
		int num1 = sc.nextInt();
		System.out.println("请输入需要计算的第二个数：");
		int num2 = sc.nextInt();
		System.out.println("请选择运算【+，-，*，/】");
		char op = sc.next().charAt(0);
		switch (op) {
		case '+':
			add(num1, num2);
			break;
		case '-':
			subtraction(num1, num2);
			break;
		case '*':
			multiply(num1, num2);
			break;
		case '/':
			divide(num1, num2);
			break;
		default:
			System.out.println("输入的运算符不支持！");
			break;
		}
	}
	public static void main(String[] args) {
		Calculator c = new Calculator();
		c.calc();
	}
}

